﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using DAL;

namespace BLL
{
    public class FunctionBll : BaseBLL
    {
        #region 构造函数

        public FunctionBll(LoginInfo info)
        {
            loginInfo = info;
        }
        #endregion

        #region 公共函数

        public FunctionInfo GetInfoById(string funID)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.GetInfoById(funID);
            return result;
        }

        public List<FunctionInfo> GetList(string funName, int funType, string actionType, out int recordCount)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.GetList(funName, funType, actionType, out  recordCount);
            return result;
        }

        public List<FunctionInfo> GetByNameWithOutGuid(string funName, string guid = null)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.GetByNameWithOutGuid(funName, guid);
            return result;
        }

        public int Insert(FunctionInfo functionInfo)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.Insert(functionInfo);
            return result;
        }

        public int Update(FunctionInfo functionInfo)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.Update(functionInfo);
            return result;
        }

        public int Delete(string funID)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            var result = funDal.Delete(funID);
            return result;
        }
        public string GetDataType(string value)
        {
            FunctionDAL funDal = new FunctionDAL(loginInfo);
            try
            {
                return funDal.GetDataType(value);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion
    }
}
